package haut.system.member.person;

import haut.system.member.events.SportingEvents;
import haut.util.exception.DataException;

import java.util.Vector;

/**
 * 志愿者类
 * @author MingJie Li
 * @author Jun Zhu
 */
public class Volunteer extends TeaAndStu {

    /**
     * 志愿者的报名项目
     */
    Vector<SportingEvents> myEvents = new Vector<SportingEvents>();

    /**
     * 志愿者<code>Volunteer</code>类的有参构造函数
     * @param stu 师生类
     * @param events 首个报名项目
     * @throws DataException
     */
    public Volunteer(TeaAndStu stu, SportingEvents events) throws DataException {
        super(stu.id, stu.name);
        this.myEvents.add(events);//首个报名项目
    }
    /**
     * 返回志愿者报名项目的集合
     * @return {Vector} myEvents
     */
    public Vector<SportingEvents> getMyEvents() {
        return myEvents;
    }

    /**
     * 查看志愿报名的项目
     */
    public void checkMyEvents() {
        Vector<SportingEvents> events = getMyEvents();
        int size = events.size();
        SportingEvents event = null;
        for (int i = 0; i < size; ++i) {
            event = events.get(i);
            System.out.println(event.getName());//读出志愿报名的项目,名字
        }
    }

    /**
     * 加入新项目
     * @param event
     */
    public void addEvent(SportingEvents event) {
        myEvents.add(event);
    }
}